package top.yudoge.dogeeditorserverj.db;

import top.yudoge.dogeeditorserverj.db.config.SQLDataSource;
import top.yudoge.dogeeditorserverj.db.exceptions.BootStrapError;
import top.yudoge.dogeeditorserverj.db.mysql.MySQLDataSourceConnector;

public class SQLDataSourceConnectorFactory {
    public static SQLDataSourceConnector fromSQLDataSource(SQLDataSource dataSource) {
        String type = dataSource.getType();
        switch (type) {
            case "mysql":
                return new MySQLDataSourceConnector(dataSource);
            default:
                throw new BootStrapError("Unsupported datasource type => " + dataSource);
        }
    }
}
